package concurrency.chapter2;

public class TicketWindow extends Thread {
    private final String name;
    private static final int MAX = 50;
    //static可以实现多个线程访问同一个数据，不会出现重复数据，但生命周期太长
    private static int index = 1;

    public TicketWindow(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        while (index <= MAX)
            System.out.println("柜台：" + name + "当前的号码是：" + index++);
    }
}
